#ifndef _GT_QRCODE_SRC_H_
#define _GT_QRCODE_SRC_H_

#include<string.h> 
#include<stdio.h>
#include "../../widgets/gt_conf_widgets.h"

#if GT_CFG_ENABLE_QRCODE == 1
//ECLevl的宏定义:
#define 	ECLevel_L		0 
#define 	ECLevel_M		1 
#define 	ECLevel_Q		2 
#define 	ECLevel_H		3 

//MaskNub的宏定义:
#define   MaskPattern0  0
#define   MaskPattern1  1
#define   MaskPattern2  2
#define   MaskPattern3  3
#define   MaskPattern4  4
#define   MaskPattern5  5
#define   MaskPattern6  6
#define   MaskPattern7  7
//CodeMode的宏定义:
#define 	Mode_Unicode	10
#define 	Mode_GBK 		11
#define 	Mode_KSC5601	12
#define 	Mode_SHIFT_JIS	13 
 //该函数参考 spi参考文件
// extern unsigned long r_dat_bat(unsigned long address,unsigned long DataLen,unsigned char *pBuff);
// extern unsigned char versionN;				//内部定义, QR版本号
// extern unsigned char QRDataBuf[4072]; 		//自行定义, 二维码图形数组
// extern unsigned char QRCodeDataBuf[3706];	//自行定义

int gt_qrcode_init(unsigned char version , unsigned char* qrdata_buff , unsigned char* qrcodedata_buff);

/*******************************************
ascii&汉字二维码函数 unsigned char
//str: 编码的数组, length: 该数组的大小
*******************************************/  
unsigned char gt_qrcode_get(unsigned char CodeMode,unsigned char ECLevel,unsigned char MaskNub, unsigned char *str,long unsigned int length);

#if 0
//调用例程
unsigned char QRCodeUnicode[]=
{
	/*跳转到baidu页面   https://www.baidu.com/ */ 
	0x00,0x68,0x00,0x74,0x00,0x74,0x00,0x70,0x00,0x73,0x00,0x3A,0x00,0x2f,
	0x00,0x2f,0x00,0x77,0x00,0x77,0x00,0x77,0x00,0x2e,0x00,0x62,0x00,0x61,
	0x00,0x69,0x00,0x64,0x00,0x75,0x00,0x2E,0x00,0x63,0x00,0x6f,0x00,0x6d,
	0x00,0x2f,
	
	/* 中文Unicode部分测试 */
//	0x4e,0x00,0x4e,0x01,0x4e,0x02,0x4e,0x03,0x4e,0x04,0x4e,0x05,0x4e,0x06,0x4e,0x07,0x4e,0x08,0x4e,0x09,
//	0x4e,0x0a,0x4e,0x0b,0x4e,0x0c,0x4e,0x0d,0x4e,0x0e,0x4e,0x0f,0x4e,0x10,0x4e,0x11,0x4e,0x12,0x4e,0x13,		
//	0x4e,0x14,0x4e,0x15,0x4e,0x16,0x4e,0x17,0x4e,0x18,0x4e,0x19,0x4e,0x1a,0x4e,0x1b,0x4e,0x1c,0x4e,0x1d,
//	0x4e,0x1e,0x4e,0x1f,0x4e,0x20,0x4e,0x21,0x4e,0x22,0x4e,0x23,0x4e,0x24,0x4e,0x25,0x4e,0x26,0x4e,0x27,
// 	0x4e,0x28,0x4e,0x29,0x4e,0x2a,0x4e,0x2b,0x4e,0x2c,0x4e,0x2d,0x4e,0x2e,0x4e,0x2f,0x4e,0x30,0x4e,0x31,
// 	0x4e,0x32,0x4e,0x33,0x4e,0x34,0x4e,0x35,0x4e,0x36,0x4e,0x37,0x4e,0x38,0x4e,0x39,0x4e,0x3a,0x4e,0x3b,
// 	0x4e,0x3c,0x4e,0x3d,0x4e,0x3e,0x4e,0x3f,0x4e,0x40,0x4e,0x41,0x4e,0x42,0x4e,0x43,0x4e,0x44,0x4e,0x45,
};

void main() {
	versionN = 3;	//范围在3~17
	qrcode_get(Mode_Unicode,ECLevel_H,MaskPattern4,QRCodeUnicode,sizeof(QRCodeUnicode));
	w=4*versionN+17; h_byte = (w+7)/8;
	//竖置横排 转 横置横排 显示
	DisZK_DZ_Y(50,50,w,h_byte*8,BLACK,WHITE,QRDataBuf,1);	//参考spi代码文件
}
#endif

#endif
/*  */

#endif
